import {Component, OnInit, Input, Renderer, AfterViewInit, ElementRef, ViewEncapsulation} from '@angular/core';
import {ImageServeService} from "@shared/service/image/image-serve.service";

@Component({
  selector: 'seed-badge-armband',
  templateUrl: './armband.component.html',
  styleUrls: ['./armband.component.scss'],
  host: {"class": "seed-badge seed-badge-armband"},
  encapsulation: ViewEncapsulation.None
})
export class ArmbandComponent implements AfterViewInit {
  private _imgUrl: string;

  @Input()
  get imgUrl() {
    return this._imgUrl;
  }

  constructor(public ele: ElementRef,
              public renderer: Renderer,
              private imgService: ImageServeService) {
    this.imgUrl = imgService.getSignupStateImg('processing');
  }

  set imgUrl(url: string) {
    this._imgUrl = url;
  }

  ngAfterViewInit() {
    this.renderer.setElementStyle(this.ele.nativeElement, 'background-image', `url(${this.imgUrl})`);
  }


}
